package org.lanyu.springainovel.common.event;

import lombok.Getter;
import org.lanyu.springainovel.common.entity.ServerConfig;
import org.springframework.context.ApplicationEvent;

@Getter
public class ServerConfigChangeEvent extends ApplicationEvent {

    private final String serverName;
    private final ServerConfig config;
    private final boolean add;
    private final boolean remove;

    /**
     * 创建添加/更新服务器配置事�?
     */
    public ServerConfigChangeEvent(Object source, String serverName, ServerConfig config) {
        super(source);
        this.serverName = serverName;
        this.config = config;
        this.add = true;
        this.remove = false;
    }

    /**
     * 创建移除服务器配置事�?
     */
    public ServerConfigChangeEvent(Object source, String serverName) {
        super(source);
        this.serverName = serverName;
        this.config = null;
        this.add = false;
        this.remove = true;
    }

}
